package com.icehand.payment.model;

import com.alibaba.fastjson.JSONObject;
import com.icehand.common.code.CodeEnum;
import com.icehand.common.enums.PayChannelEnum;
import com.icehand.common.model.BaseOrder;
import com.icehand.common.result.BizResult;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.client.RestTemplate;

import java.util.Map;

/**
 * @author icehand
 */
@Data
@Accessors(chain = true)
public class PayWrapper {
    /**
     * 配置信息
     */
    private JSONObject config;

    /**
     * 渠道
     */
    private PayChannelEnum payChannelEnum;

    /**
     * 订单基本信息
     */
    private BaseOrder baseOrder;

    /**
     * 扩展map，需要clientIp , 当为微信H5支付时，需要传入openId
     */
    private Map<String,String> extendMap;

    /**
     * output
     */
    private BizResult<Object> bizResult = new BizResult<>();

    public void error(CodeEnum<Integer> codeEnum){
        bizResult.setCode(codeEnum.getCode());
        bizResult.setMsg(codeEnum.getMsg());
    }

    public void putData(Object object){
        this.bizResult.setData(object);
    }

}
